-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core-amqp][event-hubs] add support for NamedKeyCredential and SASCredential #14423
Conversation
@@ -39,3 +39,4 @@ export { | |||
} from "./util/utils"; | |||
export { AmqpAnnotatedMessage } from "./amqpAnnotatedMessage"; | |||
export { logger } from "./log"; | |||
export * from "./internals"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really wanted to do export * as Internals from "./internals";
but unfortunately api-extractor doesn't support it (yet).
microsoft/rushstack#2412
/azp run js - event-hubs - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
d9026c7
to
430b188
Compare
/azp run js - event-hubs - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
…nProvider into its final form: SasTokenProvider!
430b188
to
30202e8
Compare
/azp run js - event-hubs - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
Updated based on feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved! I have gone over all the code changes in the non test files and they look good to me
/check-enforcer reset |
Hello @chradek! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
…dential (Azure#14423) Adds support for `NamedKeyCredential` and `SASCredential` to `@azure/event-hubs`. ## Background Event Hubs supports using token-based AAD auth via the `@azure/identity` credentials, and both "shared access key" and "shared access signature" via the connection string. This change allows the `EventHubConsumerClient` and `EventHubProducerClient` to support both "shared access key" and "shared access signature" methods of auth via credential objects defined by `@azure/core-auth`. ## It already supports connection strings, so why add 2 more credential types? Both the `AzureNamedKeyCredential` and `AzureSASCredential` classes support rotation by calling their respective `update` methods. Since connection strings can't be rotated within a client, the user would need to close their existing clients (which may be in the process of sending or receiving events!) and create new ones if their keys were rotated. With this change, the user only needs to call `update` on the credential they passed to their Event Hubs client, and the client will automatically use the new values. ## Why is this change in core-amqp as well? Service Bus and Event Hubs both need these changes. Note that the APIs added to core-amqp have the `@hidden` tag so they won't show up in documentation. ## TODO - [x] verify that the SDK retries 'unauthorized' errors. This, and the token expiry, will determine when the clients attempt to use the rotated credentials.
Adds support for
NamedKeyCredential
andSASCredential
to@azure/event-hubs
.Background
Event Hubs supports using token-based AAD auth via the
@azure/identity
credentials, and both "shared access key" and "shared access signature" via the connection string.This change allows the
EventHubConsumerClient
andEventHubProducerClient
to support both "shared access key" and "shared access signature" methods of auth via credential objects defined by@azure/core-auth
.It already supports connection strings, so why add 2 more credential types?
Both the
AzureNamedKeyCredential
andAzureSASCredential
classes support rotation by calling their respectiveupdate
methods. Since connection strings can't be rotated within a client, the user would need to close their existing clients (which may be in the process of sending or receiving events!) and create new ones if their keys were rotated.With this change, the user only needs to call
update
on the credential they passed to their Event Hubs client, and the client will automatically use the new values.Why is this change in core-amqp as well?
Service Bus and Event Hubs both need these changes. Note that the APIs added to core-amqp have the
@hidden
tag so they won't show up in documentation.TODO